/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sahd.broker.proxys;

import sahd.broker.iONetMessageManager.IONetMessageManager;
import java.io.IOException;
import java.net.*;
import java.net.UnknownHostException;
import java.util.Observer;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Omega Zero
 */
public class ProxyServer {

    private IONetMessageManager ioNetMessageManager;

        public ProxyServer(Observer serverReceiver, int outPort, int entryPort,
                String initReceiverIpAddres) throws UnknownHostException, SocketException{
            try {
                ioNetMessageManager = new IONetMessageManager(serverReceiver, outPort,
                        entryPort, initReceiverIpAddres);
            } catch (UnknownHostException ex) {
                Logger.getLogger(ProxyServer.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(ProxyServer.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        public void shipMessage(Object message, int protocol) throws IOException{
            ioNetMessageManager.shipMessage(message, protocol);
        }
        
        public void shipMessage(Object message, int protocol, String originalSourceIPAddress, int serviceRequestedProtocol) throws IOException {
            ioNetMessageManager.shipMessage(message, protocol, serviceRequestedProtocol);
        }
        public void setReceiverIpAddress(String receiverIpAddress) throws UnknownHostException, IOException{
            this.ioNetMessageManager.setReceiverIpAddres(receiverIpAddress);
        }

        public void setOutPort(int outPort){
            this.ioNetMessageManager.setOutPort(outPort);
        }
        public void setEntryPort(int entryPort){
            this.ioNetMessageManager.setEntryPort(entryPort);
        }



    }
